package acm.蓝桥杯二分前缀;

import java.util.Arrays;
import java.util.Random;

public class Test轻重分配 {
    public static void main(String[] args) {
        int[] nums={7, 78, 99, 59, 27, 78, 46, 39};
//        compare(); 5 4  7  27  39 46 59 78 78 99
        Arrays.sort(nums);
        System.out.println(Arrays.toString(nums));
    }

    public static void compare(){
        Random r=new Random();
        int count=1000_000;
        while (count-- > 0) {
            int n = r.nextInt(10);
            int[] nums = new int[n];
            for (int i = 0; i < nums.length; i++) {
                nums[i]=r.nextInt(100);
            }

            int fun = 轻重分配.fun(nums.clone());
            int ans = 轻重分配2.fun(nums.clone());
            if (ans!=fun){
                System.out.println("fun:"+fun+";\tans:"+ans);
                System.out.println(Arrays.toString(nums));
            }
        }
    }
}
